package com.example.demo.model;

import com.example.demo.enums.ResultCode;
import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2025-06-08
 * Time: 21:22
 */
@Data
public class Result<T> {
    private ResultCode code;//200成功 -1未登录 -2异常
    private String errorMsg;
    private T data;

    public static <T> Result<T> success(T data){
        Result result=new Result<>();
        result.setCode(ResultCode.SUCCESS);
        result.setData(data);
        return result;
    }
    public static <T> Result<T> unlogin(){
        Result result=new Result<>();
        result.setCode(ResultCode.UNLOGIN);
        result.setErrorMsg("用户未登录");
        return result;
    }
}
